﻿using System;
using System.Collections.Generic;
using GeoAPI.Geometries;

namespace NetTopologySuite.Noding
{
	public class SimpleNoder : SinglePassNoder
	{
		public SimpleNoder()
		{
		}

		public SimpleNoder(ISegmentIntersector segInt) : base(segInt)
		{
		}

		public override IList<ISegmentString> GetNodedSubstrings()
		{
			return NodedSegmentString.GetNodedSubstrings(this._nodedSegStrings);
		}

		public override void ComputeNodes(IList<ISegmentString> inputSegStrings)
		{
			this._nodedSegStrings = inputSegStrings;
			foreach (ISegmentString e in inputSegStrings)
			{
				foreach (ISegmentString e2 in inputSegStrings)
				{
					this.ComputeIntersects(e, e2);
				}
			}
		}

		private void ComputeIntersects(ISegmentString e0, ISegmentString e1)
		{
			Coordinate[] coordinates = e0.Coordinates;
			Coordinate[] coordinates2 = e1.Coordinates;
			for (int i = 0; i < coordinates.Length - 1; i++)
			{
				for (int j = 0; j < coordinates2.Length - 1; j++)
				{
					base.SegmentIntersector.ProcessIntersections(e0, i, e1, j);
				}
			}
		}

		private IList<ISegmentString> _nodedSegStrings;
	}
}
